﻿@model List<FI.OnlineEducation.Data.Entities.TeachingPlan>
@{
    IDictionary<int, int> member_count = ViewBag.MemberCountDic;
}

@functions {

    public string showStatus(int status)
    {
        if (status == 0)
        {
            return "未开始";
        }
        else if (status == 1)
        {
            return "进行中";
        }
        else if (status == 2)
        {
            return "完成";
        }
        else
        {
            return "未发布";
        }
    }
}

@for (int i = 0; i < Model.Count / 3 + 1; i++)
{

    <div class="row">
        @{
            var threes = Model.Skip((i % 3) * 3).Take(3);

            foreach (var item in threes)
            {
                if (item != null)
                {
                    int total = item.TeachingPlanItems.Count;

                    int finished = item.TeachingPlanItems.Where(n => n.Status == 2).Count();

                    <div class="col-xl-4">
                        <div class="card-box course-box">
                            <div class="dropdown float-right">
                                <button type="button" onclick="javascript:window.location.href='/Booking/Detail/@item.CourseId'" class="btn btn-danger btn-rounded mb-3"> @*进入到详情页面，应该是courseId*@
                                    @*@if (item.Status == 0|| item.Status == 1)
                                        {
                                            <i class="mdi mdi-plus"></i><span> 预定</span>
                                        }
                                        else
                                        {
                                            <i class="mdi mdi-eye-check"></i><span> 查看</span>
                                        }*@
                                    <i class="mdi mdi-eye-check"></i><span> 详情</span>
                                </button>
                                @*<a href="apps-projects.html#" class="dropdown-toggle card-drop arrow-none" data-toggle="dropdown" aria-expanded="false">
                                          <i class="mdi mdi-dots-horizontal m-0 text-muted h3"></i>
                                    </a>
                                      <div class="dropdown-menu dropdown-menu-left">
                                          <a class="dropdown-item" href="apps-projects.html#">Edit</a>
                                          <a class="dropdown-item" href="apps-projects.html#">Delete</a>
                                          <a class="dropdown-item" href="apps-projects.html#">Add Members</a>
                                          <a class="dropdown-item" href="apps-projects.html#">Add Due Date</a>
                                      </div>*@
                            </div> <!-- end dropdown -->
                            <!-- Title-->

                            <h4 class="mt-0"><a href="javascript: void(0);" class="text-dark">@item.Course.Title</a></h4>
                            <p class="text-muted text-uppercase"><i class="mdi mdi-subtitles-outline"></i> <small>@item.Course.SubTitle</small></p>
                            <div class="badge bg-soft-success text-success mb-2">@showStatus(item.Status)</div>

                            <!-- Desc-->
                            <p class="text-muted font-13 mb-2 sp-line-2">
                                @Html.Raw(item.Course.Description)  @*<a href="javascript:void(0);" class="font-weight-bold text-muted">更多...</a>*@
                            </p>
                            <div>
                                <span>授课教师</span>
                            </div>

                            <!-- Team-->
                            <div class="avatar-group mb-0">
                                <a href="/Teacher/Detail/@item.Teacher.Id" class="avatar-group-item" data-toggle="tooltip" data-placement="top" title="" data-original-title="timmy">
                                    <img src="~/assets/images/users/user-1.jpg" class="rounded-circle avatar-sm" alt="@item.Teacher.FullName" />
                                </a>
                                <span>@Html.Raw(item.Teacher.Intro)</span>
                            </div>
                            <!-- Task info-->
                            <p class="mb-1">
                                <span class="text-nowrap mb-2 d-inline-block">
                                    <i class="fa fa-user-alt text-muted"></i>
                                    <b>@member_count[item.Id]</b> 学员
                                </span>
                                <span class="pr-2 text-nowrap mb-2 d-inline-block">
                                    <i class="mdi mdi-format-list-bulleted-type text-muted"></i>
                                    <b>@item.TeachingPlanItems.Count</b> 课时
                                </span>

                                <span class="text-nowrap mb-2 d-inline-block">
                                    <i class="mdi mdi-comment-multiple-outline text-muted"></i>
                                    <b>@item.Evaluations.Count</b> 评论
                                </span>
                            </p>

                            <!-- Progress-->
                            <p class="mb-2 font-weight-bold">目前进度: <span class="float-right">@finished/@total</span></p>
                            <div class="progress mb-1" style="height: 7px;">
                                <div class="progress-bar"
                                     role="progressbar" aria-valuenow="34" aria-valuemin="0" aria-valuemax="100"
                                     style="width:@(finished/total*100)%;">
                                </div><!-- /.progress-bar .progress-bar-danger -->
                            </div><!-- /.progress .no-rounded -->

                        </div> <!-- end card box-->
                    </div><!-- end col-->
                }
            }

        }
    </div>


    <!-- end row -->





}
